package cn.com.clearcloud.store.controller;

import cn.com.clearcloud.store.service.StoreService;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/store")
@AllArgsConstructor
public class StoreController {

    private final StoreService storeService;

    @PostMapping(value = "/deduct/{commodityCode}/{count}")
    public Integer deduct(@PathVariable("commodityCode") String commodityCode,
                          @PathVariable("count") Integer count) {
        return storeService.deduct(commodityCode, count);
    }
}
